package com.xcdh.ittools.controller;

import com.api.ittools.entity.ToolDatasource;
import com.xcdh.commons.utils.EncryptUtil;
import com.xcdh.domain.vo.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pyApi")
public class PythonApiController {

    @PostMapping("/DESencode")
    public R DESencode(@RequestBody ToolDatasource toolDatasource){
        String codePad = EncryptUtil.getInstance().DESencode(toolDatasource.getPassword(), toolDatasource.getUsername());
        return R.okData(codePad) ;
    }

    @PostMapping("/DESdecode")
    public R DESdecode(@RequestBody ToolDatasource toolDatasource){
        String decodePwd = EncryptUtil.getInstance().DESdecode(toolDatasource.getPassword(), toolDatasource.getUsername());
        return R.okData(decodePwd) ;
    }
}




